/*
 * Copyright 2016 ZTE Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
(function(Application){
	
	Application.Constant.Element_WhileStart = "While";
	
	Application.registerElement(Application.View.Element.extend({

		// content: function(){
		// 	return "";
		// },

		css: function(){
			return {
				"-webkit-transform": "rotate(45deg)",
				"-moz-transform": "rotate(45deg)",
				"-ms-transform": "rotate(45deg)",
				"-o-transform": "rotate(45deg)",
				"background-image": "url('')",
				"background-size": "cover",
				"border": "2px solid #000",
				"height": "30px",
				"padding": "8px",
				"transform": "rotate(45deg)",
				"width": "30px"
			};
		},

		dialog: function(event){
			
			var dialog = new Application.View.Dialog({
				id: (this.model.get("id") + "_dialog"),
				model: this.model,
				title: "Edit While Event"
			});

			dialog.on("confirm", function(event){
				this.model.set({
					condition: event.dialog.$el.find("#condition").val()
				});
			});
			dialog.on("show", function(event){
				event.dialog.$el.find("form").append(
					"<div class=\"form-group\">"
						+"<label for=\"\" class=\"col-sm-3 control-label\">condition</label>"
						+"<div class=\"col-sm-9\"><input type=\"text\" autocomplete=\"off\" class=\"form-control\" id=\"condition\" name=\"condition\" value=\"\"/></div>"
					+"</div>"
				);
				
				event.dialog.$el.find("input").val(this.model.get("condition"));
			});
			dialog.show();
		}

	}, {type: "While"}));

})(window.BPMN4TOSCAModeler);